<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of PositionRules
 *
 * @author LBerrocal
 */
class PositionRules {

    public static function validate(Position $position){
        $businessErrors = array();
        if($position->getMonthlySalary() < $position->getWageType()->getMinimumMonthlyWage()){
            $msg =sprintf("El salario %s no cumple con el salario mínimo definido para %s (%s)",
                    $position->getMonthlySalary(),
                    $position->getWageType()->getMinimumMonthlyWage(),
                    $position->getWageType()->getName()
                    );
            $businessErrors['MinimumMonthlyWage']= $msg;
        }
        if($position->getShiftAssignment()->count() == 0){
           $msg ="La posición no tiene horarios asignados";
           $businessErrors['NoShiftAssignments']= $msg;
        }

        return $businessErrors;
    }
}
?>
